package com.andreas.task;

import com.andreas.service.BookService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author andreaszhou
 * @ClassName ComputerTask
 * @Description TODO
 * @date 2021/1/22 13:31
 * @Version 1.0
 */
/*
* 自动完成计算的任务
* */
@Component
public class ComputerTask {
    @Resource
    private BookService bookServiceImp;
    /*任务调度，自动完成计算的任务*/
    @Scheduled(cron = "0 * * * * ?")
    public void updateEvaluation(){
        bookServiceImp.updateEvaluationService();
        System.out.println("已经更新所有的图书的评分");
    }
}
